﻿/* tslint:disable:jsdoc-format max-line-length */
// warning: Generated code! Do not change!
module App {
	"use strict";
	export class AjaxHelper {
		constructor(public baseUrl: string) {
			if (baseUrl.match(/\/$/)) {
				baseUrl += "/";
			}
		}

		request(url: string, httpVerb: string, data?: any): JQueryXHR {
			var settings: JQueryAjaxSettings = {
				cache: false,
				async: true,
				timeout: 2000,
				dataType: "json",
				contentType: "application/json",
				type: httpVerb,
				url: this.baseUrl + url
			};

			if (data !== undefined) {
				settings.data = JSON.stringify(data);
			}

			var res = $.ajax(settings);
			return res;
		}
	}
}